home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / crc_lib2 / crc.h next >
C/C++ Source or Header  |  1994-03-10  |  2KB  |  68 lines

  1. /* ------------------------------------------------------------------------
  2.  *        CRC.LIB
  3.  *        Assemblerroutines (68000er) for CRC calculations;
  4.  *
  5.  *        (c) 1994 by Jan Kriesten, D-35039 Marburg, FidoNet: 2:244/4344
  6.  *
  7.  *        The CRC tables are included in the library.
  8.  * 
  9.  *        The xxBlk-Routines will automatically branch to xxShort
  10.  *        if blocklength < 0xffffL.
  11.  */
  12.  
  13. #ifndef __CRC_H__
  14. #define __CRC_H__
  15.  
  16. /*--- includes              ---*/
  17.  
  18. /*--- defines               ---*/
  19.  
  20. /*--- types                 ---*/
  21.  
  22. /*--- variables             ---*/
  23.  
  24. /*--- prototypes            ---*/
  25.  
  26. /*
  27.  * CRC-CCITT (x^16+x^12+x^5+1)
  28.  */
  29. extern    unsigned int    Crc16cTab[256];
  30.  
  31. unsigned int    Crc16cStr        ( unsigned char *str );
  32. unsigned int    Crc16cBlk        ( unsigned char *blk, unsigned long length );
  33. unsigned int    Crc16cUpd        ( unsigned int crc, unsigned char c );
  34. unsigned int    Crc16cBlkUpd    ( unsigned int oldcrc, unsigned char *blk, unsigned long length );
  35. unsigned int    Crc16cShort        ( unsigned int oldcrc, unsigned char *blk, int length );
  36.  
  37. /*
  38.  *  The return values of the following functions have to be
  39.  *  negated at the end of calculation!
  40.  */
  41.  
  42. /*
  43.  * CRC-16 (x^16+x^15+x^2+1)
  44.  */
  45. extern    unsigned int    Crc16Tab[256];
  46.  
  47. unsigned int    Crc16Str        ( unsigned char *str );
  48. unsigned int    Crc16Blk        ( unsigned char *blk, unsigned long length );
  49. unsigned int    Crc16Upd        ( unsigned int crc, unsigned char c );
  50. unsigned int    Crc16BlkUpd        ( unsigned int oldcrc, unsigned char *blk, unsigned long length );
  51. unsigned int    Crc16Short        ( unsigned int oldcrc, unsigned char *blk, int length );
  52.  
  53.  
  54. /*
  55.  * CRC-32 (x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1)
  56.  */
  57. extern    unsigned long    Crc32Tab[256];
  58.  
  59. unsigned long    Crc32Str        ( unsigned char *str );
  60. unsigned long    Crc32Blk        ( unsigned char *blk, unsigned long length );
  61. unsigned long    Crc32Upd        ( unsigned long crc, unsigned char c );
  62. unsigned long    Crc32BlkUpd        ( unsigned long oldcrc, unsigned char *blk, unsigned long length );
  63. unsigned long    Crc32Short        ( unsigned long oldcrc, unsigned char *blk, int length );
  64.  
  65. /*--- End of crc.h module  ---*/
  66. #endif
  67.  
  68.